import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  },
  {
    path: '/home',
    name: 'home',
    component: () => import(/* webpackChunkName: "about" */ '../page/home.vue')
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import(/* webpackChunkName: "about" */ '../page/deatil.vue')
  },
  {
    path: '/shopcar',
    name: 'shopcar',
    component: () => import(/* webpackChunkName: "about" */ '../page/shopcar.vue')
  },
  {
    path: '/address',
    name: 'address',
    component: () => import(/* webpackChunkName: "about" */ '../page/adress.vue')
  },
  {
    path: '/address1',
    name: 'address1',
    component: () => import(/* webpackChunkName: "about" */ '../page/address.vue')
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
